import Vue from 'vue'
import App from './App'
// 引入uview
import uView from "uview-ui";
import store from './store'
Vue.use(store)
Vue.use(uView);

Vue.config.productionTip = false

App.mpType = 'app'

uni.$u.http.setConfig((config) => {
  /* config 为默认全局配置*/
  config.baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1' /* 根域名 */
  return config
})

uni.$u.http.interceptors.request.use(config => {
  const { token } = store.state.user
  if (token) {
    config.header = { ...config.header, Authorization: token }
  }
  return config
})



const app = new Vue({
  store,
  ...App
})
app.$mount()
